<template>
    <el-card>
        <div slot="header" class="clearfix">
            <span style="line-height: 36px;">{{type}}医院</span>
            <el-button type="primary" style="float:right" @click="submint">
                提交
            </el-button>
        </div>
        <el-form :inline="true"  :model="form" class="demo-form-inline">
            <el-row :gutter="20">
                <el-col :span="12">
                    <el-form-item label="名称" label-width="150px">
                        <el-input v-model="form.HOSPITAL_NAME"></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="医疗体系" label-width="150px">
                        <el-select v-model="form.HOSPITAL_SYSTEM" placeholder="医疗体系">
                            <el-option label="私立" value="私立"></el-option>
                            <el-option label="公立" value="公立"></el-option>
                        </el-select>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row :gutter="20">
                <el-col :span="12">
                    <el-form-item label="电话" label-width="150px">
                        <el-input v-model="form.HOSPITAL_TEL"></el-input>
                    </el-form-item>
                </el-col>

                <el-col :span="12">
                    <el-form-item label="所属地区" label-width="150px">
                          <el-input v-model="form.HOSPITAL_ADDRESS"></el-input>                      
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row :gutter="20">
                 <el-col :span="12">
                    <el-form-item label="详细地址" label-width="150px">
                        <el-input v-model="form.HOSPITAL_ADDRESSDETAIL"></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="建立时间" label-width="150px">
                        <el-input v-model="form.HOSPITAL_BEGINTIME"></el-input>
                    </el-form-item>
                </el-col>

               
            </el-row>
            <el-row :gutter="20">
                 <el-col :span='12'>

                    <el-form-item label="擅长专业" label-width="150px">
                        <el-input v-model="form.HOSPITAL_MAJOR"></el-input>
                    </el-form-item>
                </el-col>
                

                <el-col :span="12">
                    <el-form-item label="床位数" label-width="150px">
                        <el-input v-model="form.HOSPITAL_BEDNUMBER"></el-input>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row :gutter="20">
                <el-col :span="12">
                    <el-form-item label="医院类型" label-width="150px">
                        <el-select v-model="form.HOSPITAL_TYPE" placeholder="医院类型">
                            <el-option label="社区医院" value="社区医院"></el-option>
                            <el-option label="专科医院" value="专科医院"></el-option>
                            <el-option label="综合型医院" value="综合型医院"></el-option>
                        </el-select>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="是否有急诊科室" label-width="150px">
                        <el-select v-model="form.HOSPITAL_ISEMERGENCY" placeholder="是否有急诊科室">
                            <el-option label="是" value="是"></el-option>
                            <el-option label="否" value="否"></el-option>
                           
                        </el-select>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="官方网站" label-width="150px">
                        <el-input v-model="form.HOSPITAL_WEB"></el-input>
                    </el-form-item>
                </el-col>
             
            </el-row>

        </el-form>
    </el-card>
</template>

<script>
import api from "@/js/api";
import getid from "@/js/getid";
export default {
  data() {
    return {
      name: "",
      form: {
        HOSPITAL_ID: "",
        HOSPITAL_NAME: "",
        HOSPITAL_SYSTEM: "",
        HOSPITAL_TEL: "",
        HOSPITAL_ADDRESS: "",
        HOSPITAL_BEGINTIME: "",
        HOSPITAL_MAJOR: "",
        HOSPITAL_TYPE: "",
        HOSPITAL_BEDNUMBER: "",
        HOSPITAL_ISEMERGENCY: "",
        HOSPITAL_WEB: "",
        HOSPITAL_ADDRESSDETAIL:''
      }
    };
  },
  props: {
    type: {
      type: String,
      default: ""
    }, Id: {
      type: String,
      default: ""
    }
  },
  methods: {
    submint() {
      if (this.type == "新增") {
        this.form.HOSPITAL_ID = getid.getid();
        api.HOSPITALAdd(this, this.form);
      } else {
            api.HOSPITALUpdate(this, this.form);
      }
    }
  },
  created() {
    if (this.type == "查看") {
      let that = this;
      api.HOSPITALGetOne(that, { Id: that.Id }, function(msg) {
        that.form = msg.Result;
      });
    }
  }
};
</script>

<style>

</style>
